/**
 * 
 */
package com.ez.supervise.service.impl;

import java.util.List;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.FileDao;
import com.ez.supervise.model.biz.File;
import com.ez.supervise.service.FileService;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at 2009-7-22
 * 
 */
public class FileServiceImpl implements FileService {
    private FileDao fileDao;
    public void setFileDao(FileDao fileDao) {
	this.fileDao = fileDao;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#delete(java.lang.Long)
     */
    public void delete(Long id) {
	fileDao.delete(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#insert(java.lang.Object)
     */
    public void insert(Object entity) {
	fileDao.insert(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#update(java.lang.Object)
     */
    public void update(Object entity) {
	fileDao.update(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#get(java.lang.Long)
     */
    public Object get(Long id) {
	return (File) fileDao.get(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.ez.supervise.service.FileService#findByPage(com.ez.supervise.core.
     * Page)
     */
    public Page findFileByPage(Page page) {
	page.setRoot(fileDao.findFileByPage(page));
	page.setTotalProperty(fileDao.findFileByCount(page));
	return page;

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.FileService#findAll()
     */
    public List findAll() {
	return fileDao.findAll();
    }

    public List findFileByPublish() {
	return fileDao.findFileByPublish();
    }

    public void publish(List idList, String publishStatus) {
	for(Object id: idList){
	    fileDao.publish((Long)id, publishStatus);
	}
	
    }
}
